function Selschool(obj, e) {
    var ths = obj;
    var dal = '<div class="_schools"><span title="关闭" id="cColse" >×</span><div id="_schoolsheng" class="_schools0">请选择学校</div><div id="_schools0" class="_schools1"></div><div style="display:none" id="_schools1" class="_schools1"></div><div style="display:none" id="_schools2" class="_schools1"></div></div>';
    Iput.show({
        id: ths,
        event: e,
        content: dal,
        width: "470"
    });
    $("#cColse").click(function() {
        Iput.colse()
    });


//var hareaValue = document.getElementById("harea").value;
// console.log(hareaValue);


    var hareaValue = document.getElementById("harea").getAttribute('data-id');
// console.log(hareaValue);

   

    var tb_school = [];
    if(hareaValue !=null)
    {var b = school;}
    else
    {var b = school1}
    for (var i = 0,
    len = b.length; i < len; i++) {
        if(b[i]['area'] == hareaValue){tb_school.push('<a data-id="' + b[i]['id'] + '" data-name="' + b[i]['name'] + '" title="' + b[i]['name'] + '">' + b[i]['name'] + '</a>')}       
    }
    $("#_schools0").append(tb_school.join(""));
    $("#_schools0 a").click(function() {
        var g = getschool1($(this));
        $("#_schools1 a").remove();
        $("#_schools1").append(g);
        $("._schools1").hide();
        $("._schools1:eq(1)").show();
        $("#_schools0 a,#_schools1 a,#_schools2 a").removeClass("AreaS");
        $(this).addClass("AreaS");
        var lev = $(this).data("name");
        ths.value = $(this).data("name");
        if (document.getElementById("hschool") == null) {
            var hschools = $('<input>', {
                type: 'hidden',
                name: "hschool",
                "data-id": $(this).data("id"),
                id: "hschool",
                val: lev
            });
            $(ths).after(hschools)
        } else {
            $("#hschool").val(lev);
            $("#hschool").attr("data-id", $(this).data("id"))
        }
        $("#_schools1 a").click(function() {
            $("#_schools1 a,#_schools2 a").removeClass("AreaS");
            $(this).addClass("AreaS");
            var lev = $(this).data("name");
            if (document.getElementById("jschool") == null) {
                var hschools = $('<input>', {
                    type: 'hidden',
                    name: "jschool",
                    "data-id": $(this).data("id"),
                    id: "jschool",
                    val: lev
                });
                $(ths).after(hschools)
            } else {
                $("#jschool").attr("data-id", $(this).data("id"));
                $("#jschool").val(lev)
            }
            var bc = $("#hschool").val();
            ths.value = bc + "/" + $(this).data("name");
            var ar = getschool2($(this));
            $("#_schools2 a").remove();
            if (ar == '') Iput.colse();
            $("#_schools2").append(ar);
            $("._schools1").hide();
            $("._schools1:eq(2)").show();
            $("#_schools2 a").click(function() {
                $("#_schools2 a").removeClass("AreaS");
                $(this).addClass("AreaS");
                var lev = $(this).data("name");
                if (document.getElementById("kschool") == null) {
                    var hschools = $('<input>', {
                        type: 'hidden',
                        name: "kschool",
                        "data-id": $(this).data("id"),
                        id: "kschool",
                        val: lev
                    });
                    $(ths).after(hschools)
                } else {
                    $("#kschool").val(lev);
                    $("#kschool").attr("data-id", $(this).data("id"))
                }
                var bc = $("#hschool").val();
                var bp = $("#jschool").val();
                ths.value = bc + "/" + bp + "/" + $(this).data("name");
                Iput.colse()
            })
        })
    })
}
function getschool1(obj) {
    var c = obj.data('id');
    var e = school;
    var f = [];
    var g = '';
    Iput.colse()
}
function getschool2(obj) {
    var c = obj.data('id');
    var e = school;
    var f = [];
    var g = '';
    for (var i = 0; i < e.length; i++) {
        for (var j = 0; j < e[i]['son'].length; j++) {
            if (e[i]['son'][j]['id'] == parseInt(c) && e[i]['son'][j]['son']) {
                f = e[i]['son'][j]['son'];
                break
            }
        }
    }
    if (f.length) {
        for (var k = 0; k < f.length; k++) {
            g += '<a data-id="' + f[k]['id'] + '" data-name="' + f[k]['name'] + '" title="' + f[k]['name'] + '">' + f[k]['name'] + '</a>'
        }
    }
    return g
}



